package com.my.study.designPatterns.singlePattern;

/**
 * 单例模式 解决多线程问题，防止同时创建对象， 效率低
 */
public class SingleSynchronized {

    private static SingleSynchronized instance;


    private SingleSynchronized(){

    }


    public static synchronized SingleSynchronized getInstance(){

        if(instance == null){
            instance = new SingleSynchronized();
        }

        return instance;

    }
}
